package com.springStudy.context.annotation.importBeanDefinitionRegistrarDemo;

import com.springStudy.context.annotation.importBeanDefinitionRegistrarDemo.bean.TestEntity;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

public class FirstImportBeanDefinitionRegistrar implements ImportBeanDefinitionRegistrar {
    @Override
    public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
        BeanDefinition beanDefinition = new RootBeanDefinition(TestEntity.class);
        registry.registerBeanDefinition("testEntity",beanDefinition);
    }
}
